/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package blackonefx;

import Game.BJGame;
import Game.UnoGame;
import Internationalization.LoadInternationalization;
import JDBC.JavaDataBase;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;

/**
 * FXML Controller class
 *
 * @author escabia
 */
public class MenuController implements Initializable {
    @FXML
    ImageView im_blackjack;
    @FXML
    ImageView im_uno;
    @FXML
    ImageView im_separator;
    @FXML
    ImageView im_help;

    
    
    /**
     * Show stats
     * @param game to know stats
     */
    private void showStats(JavaDataBase jdb, String game, int top){
        if(jdb.getbestplayers(game,top).size() > 0){
            System.out.println("                "+ LoadInternationalization.getRB().getString("best") + " " + game);
            System.out.println("**********************************************************");
            System.out.println(LoadInternationalization.getRB().getString("position") + "    " + LoadInternationalization.getRB().getString("name") + "         " + LoadInternationalization.getRB().getString("victory") + "       "+LoadInternationalization.getRB().getString("percent"));
            System.out.println("**********************************************************");
            for(int i=0; i<jdb.getbestplayers(game,top).size(); i++){
                System.out.println("   "+String.valueOf(i+1) + "       " + jdb.getbestplayers(game,top).get(i));
            }
        }
        
    }
    
    /**
     * Go to BlackJack by command line
     * @param event 
     */
    public void goto_blackjack(MouseEvent event) { 
        BJGame bj = new BJGame("/Resources1/frenchDeck.txt");
        bj.startGame();
    }      
    
    /**
     * Go to BlackJack by command line
     * @param event 
     */
    public void goto_uno(MouseEvent event) {
        UnoGame ug = new UnoGame();
        ug.startGame();
    } 
    
    /**
     * Go to stats
     * @param event by command line
     */
    public void goto_stats(MouseEvent event){
        JavaDataBase jdb = new JavaDataBase();
        showStats(jdb, "BLACKJACK",10);
        showStats(jdb, "UNO",10);
        jdb.disconnect();
    }
    
    /**
     * Go to help
     * @param event by command line 
     */
    public void goto_help(MouseEvent event) {
        System.out.println("help");
    }     
    
    /**
     * Initializes the controller class.
     * @param url
     * @param rb
     */
    @Override
    public void initialize(URL url, ResourceBundle rb) {    
       
    
    
    }    
}
